﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RuleCode.Common
{

    /// <summary>
    /// TableIndex 索引分类
    /// </summary>
    public enum TableIndexCategory
    {
        /// <summary>
        /// 聚簇索引
        /// </summary>
        CLUSTERED = 0,

        /// <summary>
        /// 非聚簇索引
        /// </summary>
        NONCLUSTERED,

        /// <summary>
        /// 唯一性索引
        /// </summary>
        UNIQUE
    }

    /// <summary>
    /// 结构体KeyCategory 表的键值的分类：主键和外键
    /// </summary>
    public enum KeyCategory
    {
        PRIMARYKEY = 0,
        FOREIGNKEY
    }

    /// <summary>
    /// 枚举FieldCategory 字段分类
    /// </summary>
    public enum FieldCategory
    {
        /// <summary>
        /// 自有字段，但不是主键和外键
        /// </summary>
        NORMAL = 0,

        /// <summary>
        /// 主键字段
        /// </summary>
        PRIMARYKEY,

        /// <summary>
        /// 外键字段
        /// </summary>
        FOREIGNKEY,

        /// <summary>
        /// 虚拟字段
        /// </summary>
        VIRTUAL,

        /// <summary>
        /// 不是字段
        /// </summary>
        OTHERS
    }

    /// <summary>
    /// 判断Table的当前状态
    /// </summary>
    public enum TableState
    { 
        /// <summary>
        /// 浏览状态
        /// </summary>
        Browse=0,

        /// <summary>
        /// 当创建新行之后但是没有插入数据库之前的状态
        /// </summary>
        Detached,

        /// <summary>
        /// 当数据处于修改的状态
        /// </summary>
        Modify


    }

    /// <summary>
    /// 枚举 DeleteAction 用来表示父子表在Delete()操作的级联关系的分类
    /// </summary>
    public enum DeleteAction
    {
        /// <summary>
        /// 主表删除，从表不做任何操作
        /// </summary>
        None = 0,

        /// <summary>
        /// 主表删除，从表相关数据也删除
        /// </summary>
        Cascade,

        /// <summary>
        /// 如果从表有相关数据，主表不能删除；否则，删除
        /// </summary>
        Restrict,

        /// <summary>
        /// 如果从表有相关数据，跳出窗体询问 是否删除；否则，删除
        /// </summary>
        CascadeAndRestrict

    }


    public enum UpdateAction
    {
        /// <summary>
        /// 未定义
        /// </summary>
        None=0,

        /// <summary>
        /// 修改操作
        /// </summary>
        Modify,

        /// <summary>
        /// 插入操作
        /// </summary>
        Insert,

        /// <summary>
        /// 增加操作
        /// </summary>
        Delete
    }
}
